#pragma once

#include <sstream>
#include <exception>
#include "FunctionInfo.h"

namespace MockItNow
{	
	class FailureException : public std::exception
	{
	public:
		
		FailureException(const char* message)
		: m_message(message)
		{
		}

		virtual const char *what() const throw()
		{
			return m_message.c_str();
		}

	private:
		std::string	m_message;
	};

	void SetFailureContext(const FunctionInfo* info);

	void ReportFailure(const std::string& message);

	template<typename E, typename A>
	std::string MakeFailureString(const std::string& message, E const expected, A const actual)
	{
		std::stringstream stream;
		stream << message << std::endl << "Expected" << std::endl << "   " << expected << std::endl << "But got" << std::endl << "   " << actual;
		return stream.str();
	}

	template<typename E, typename A>
	void ReportFailure(const std::string& message, E const expected, A const actual)
	{
		ReportFailure(MakeFailureString(message, expected, actual));
	}
}
